package com.bookstore.spring.action;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Admin on 2016/8/23.
 */
public class ModelAndView {
    /**
     * 重定向
     */
    public  static  final  boolean REDIRECT=true;
    /**
     * 转发
     */
    public  static  final  boolean FORWARD=false;
    // 默认是转发
    public boolean redirect=false;
    public String view;
    /**
     * Map 中封装的是request.setAttribute(key,val);
     */
    public Map data = new HashMap();

    public ModelAndView(String view) {
        this.view = view;
    }
    public ModelAndView(String view, boolean redirect) {
        this.view = view;
        this.redirect=redirect;
    }

    /**
     * 添加request.setAttribute(key,val);
     * @param key
     * @param obj
     */
    public void addData(String key, Object obj) {
        this.data.put(key, obj);
    }
}
